import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

export default new VueRouter({
    saveScrollPosition: true,
    routes: [
        {
            path: '/login',//登录页面
            name: 'login',
            component:require('./components/page/Login.vue').default
        },
        {
            path: '/',//后台框架页面
            name: 'home',
            component: require('./components/layout/Index.vue').default,
            children: [
                {
                    path: '/',
                    component: require('./components/page/Index.vue').default
                },
                {
                    path: '/demo',
                    component: require('./components/page/Demo.vue').default
                },
                {
                    path: '/config/',
                    component: require('./components/page/Config.vue').default,
                    children: [
                        {
                            path: 'edit/:model/:id',
                            meta: { dialog: true,title:'编辑' },
                            components: {
                                dialog : require('./components/module/Form.vue').default
                            },
                            props: { dialog: true },
                        },
                    ]
                },
                {
                    path: '/curd/:model/:actn?/:query?/',
                    component: require('./components/page/List.vue').default,
                    children: [
                        {
                            path: 'edit/:model/:id?',
                            meta: { dialog: true,title:'编辑' },
                            components: {
                                dialog : require('./components/module/Form.vue').default
                            },
                            props: { dialog: true },
                        },
                        {
                            path: 'show/:model/:id?',
                            meta: { dialog: true,title:'编辑' },
                            components: {
                                dialog : require('./components/module/Show.vue').default
                            },
                            props: { dialog: true },
                        },
                    ]
                },
                {
                    path: '/edit/:model/:id?',
                    component: require('./components/page/Edit.vue').default
                },
                {
                    path: '/show/:model/:id?',
                    component: require('./components/page/Show.vue').default
                },

                {
                    path: '/im/:id?',
                    component: require('./components/module/IM.vue').default
                },
            ]
        },
        {
            path: '*',//404
            component:require('./components/page/404.vue').default
        }
    ]
});